import { GoodsFields } from "@/interfaces/GoodsEntity";
import { ShopFields } from "@/interfaces/ShopEntity";
import { gql } from "@apollo/client";

export const GetAllGoodsQuery = gql`
    query GetAllGoods{
        getAllGoods{
            ${GoodsFields}
            shop{
                ${ShopFields}
            }
        }
    }
`
/**
 * 
 *  @Args("name") name: string,
        @Args("information", { nullable: true }) information: string,
        @Args("price", { type: () => Int }) price: number,
        @Args("status", { type: () => Int }) status: boolean,
        @Args("menu") menu: string,
        @Args("shopId", { type: () => Int }) shopId: number
 */
        export const AddGoodsMutation = gql`
        mutation AddGoods(
            $avatar:String!,
            $name:String!,
            $price:Int!,
            $status:Int!,
            $menu:String!,
            $shopId:Int!,
            $information:String
        ){
            addGoods(
                avatar:$avatar,
                name:$name,
                price:$price,
                status:$status,
                menu:$menu,
                shopId:$shopId,
                information:$information
            ){
                id
            }
        }
    `
    

export const UpdGoodsMutation = gql`
    mutation UpdGoods(
        $avatar:String,
        $id:Int!,
        $name:String!,
        $price:Int!,
        $status:Int!,
        $menu:String!,
        $shopId:Int,
        $information:String
    ){
        updGoods(
            avatar:$avatar,
            id:$id,
            name:$name,
            price:$price,
            status:$status,
            menu:$menu,
            shopId:$shopId,
            information:$information
        ){
            id
        }
    }
`

export const DelGoodsMutation = gql`
    mutation DelGoods(
        $id:Int!
    ){
        delGoods(id:$id){
            id
        }
    }
`